export function camelToDash(str){
  return str.replace(/[A-Z]/g, function(item) {
      return '-'+item.toLowerCase()
  })
}

export function randomString(len = 8) {
  let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
  let maxPos = chars.length;
  let res = "";   
  for (let i = 0; i < len; i++) {
    res += chars.charAt(Math.floor(Math.random() * maxPos));
  }
  return res;
}

export function delay(time) {
  return new Promise((resolve)=>{
    setTimeout(resolve, time);
  })
}